package com.example.comment.controller;

import com.example.comment.service.APCommentService;
import com.usian.model.comment.dtos.ApCommentDto;
import com.usian.model.comment.dtos.ApCommentLikeDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * apcomment控制器
 *
 */
@RestController
@RequestMapping("comment/v1")
public class APCommentController {
    @Autowired
    APCommentService apCommentService;
    
    /**
     * 添加评论
     *
     * @param apCommentDto 美联社评论dto
     */
    @PostMapping("add_comment")
    public ResponseResult addComment(@RequestBody ApCommentDto apCommentDto){
        return apCommentService.addComment(apCommentDto);
    }
    
    /**
     * 点赞操作
     *
     * @return {@code ResponseResult}
     */
    @PostMapping("like")
    public ResponseResult like(@RequestBody ApCommentLikeDto apCommentLikeDto){
        return apCommentService.like(apCommentLikeDto);
    }
}
